Self destruct might not work in case of executable file · Issue #114 · Smug246/Luna 您所在的位置:网站首页 pyinstaller path Self destruct might not work in case of executable file · Issue #114 · Smug246/Luna

Self destruct might not work in case of executable file · Issue #114 · Smug246/Luna

#Self destruct might not work in case of executable file · Issue #114 · Smug246/Luna| 来源: 网络整理| 查看: 265

The __file__ variable is the path to the source file. But when it is packed with pyinstaller, this path does not work anymore. To get the path of exe, you need to use sys.executable variable.

Further, when you run the source file, its read instantly and then executed. The file is not locked in any way. But in case of executable files, they are locked by the subprocess. Hence, you cannot call os.remove() on them.

If you want it to self destruct, you need to make another program delete it, or I should say, you need to use the delete command after the exe is finished running.



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有